package cc.autoapi.pucong.auto.flow.core.flow.execNode.selfenum;


public enum DataTypeEnum {

    NUMBER(0, "number"),
    STRING(1, "string"),
    TXT(2, "txt"),
    BOOLEAN(3, "Boolean"),
    DATE(4, "Date"),
    LIST(5, "List"),
    MAP(6, "map"),
    // 任意类型的数据
    OBJECT(7, "Object");

    private Integer type;
    private String name;

    DataTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public static DataTypeEnum getItemByValue(Integer value) {
        DataTypeEnum[] itemArr = DataTypeEnum.values();
        if (value != null) {
            for (DataTypeEnum item : itemArr) {
                if (value.equals(item.type)) {
                    return item;
                }
            }
        }
        return null;
    }
    public static DataTypeEnum getItemByName(String name) {
        DataTypeEnum[] itemArr = DataTypeEnum.values();
        if (name != null) {
            for (DataTypeEnum item : itemArr) {
                if (name.equals(item.getName())) {
                    return item;
                }
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public String getName() {
        return name;
    }
}
